/**
 * This class makes a panel that shows the slides.
 *
 * @autor Timothy Huber, Joris Clevenbergs, Rik verschuren, Wim Van der Wilt
 */

package be.kdg.netpresentadmin;

import javax.swing.*;
import java.awt.*;

public class ImagePanel extends JPanel {

	// Default serial ID
	private static final long serialVersionUID = 1L;
	
	// Place holder for the images to be shown. Initialization
	// is done with null as at this point no image information
	// can be known or ready.
	private Image image = null;


	// Constructor of ImagePanel that initializes the Panel;
	public ImagePanel() {
		this.image = null;
		setLayout(null);
	}

	// Updates the image content of the panel @param image
	// ImageIcon to display. Loads the ImageIcon and repaints the panel.
	public void updateImage(ImageIcon image) {
		this.image = image.getImage();
		repaint();
	}

	// Paints the component.
	// @param g  graphics to display
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		g.drawImage(image, 0, 0, this);
	}
}
